import { JSEncrypt } from 'jsencrypt'

const RSA_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnELfK77L0IwkE+oJNqqLvNx6hwdUrjLshOKo7exMlafMoTJZxiF1PeEkhQMgFzP0qdRXejXs9VZDIirhR7/7+sMwKrrGd1808Z6AFElYMwNercF1rJkcmOrJRSFtwn5J7gZd5fTT2r4KVE21z7HOYP4V7VyUmYlkSlUWGe2IfZE/fB8QwUQQRoXGfgB93deuwI09sVswNyyYuJVxrXf8yyB9yTAWWkLgzFvKnChXsRmiYRNdy1t/xJpiGVW/ZVC8dVMjcnCdDm7qHurztDkcjYfhdMGl8fLDkSMulqNF1WfPlxBlos5i1jGLA37lhPgskOiI470I2syJdFTKe6sn2QIDAQAB";


//  加密
export const doEncryptor =  function encryptedData(data: any) {
    // 新建JSEncrypt对象
    let encryptor = new JSEncrypt();
    // 设置公钥
    encryptor.setPublicKey(RSA_PUBLIC_KEY);
    // 加密数据
    return encryptor.encrypt(data);
}


